# Copyright 2022 Ant Group Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("//bazel:yacl.bzl", "yacl_cc_library", "yacl_cc_test")

package(default_visibility = ["//visibility:public"])

yacl_cc_library(
    name = "barrier",
    srcs = ["barrier.cc"],
    hdrs = ["barrier.h"],
    deps = [
        "//yacl/base:exception",
        "//yacl/link:context",
        "//yacl/link:trace",
        "@com_github_fmtlib_fmt//:fmtlib",
    ],
)

yacl_cc_test(
    name = "barrier_test",
    srcs = ["barrier_test.cc"],
    deps = [
        ":barrier",
        "//yacl/link:test_util",
    ],
)

yacl_cc_library(
    name = "broadcast",
    srcs = ["broadcast.cc"],
    hdrs = ["broadcast.h"],
    deps = [
        "//yacl/base:exception",
        "//yacl/link:context",
        "//yacl/link:trace",
        "@com_github_fmtlib_fmt//:fmtlib",
        "@com_google_absl//absl/numeric:bits",
    ],
)

yacl_cc_test(
    name = "broadcast_test",
    srcs = ["broadcast_test.cc"],
    deps = [
        ":broadcast",
        "//yacl/link:test_util",
    ],
)

yacl_cc_library(
    name = "scatter",
    srcs = ["scatter.cc"],
    hdrs = ["scatter.h"],
    deps = [
        "//yacl/base:exception",
        "//yacl/link:context",
        "//yacl/link:trace",
        "@com_github_fmtlib_fmt//:fmtlib",
    ],
)

yacl_cc_test(
    name = "scatter_test",
    srcs = ["scatter_test.cc"],
    deps = [
        ":scatter",
        "//yacl/link:test_util",
    ],
)

yacl_cc_library(
    name = "gather",
    srcs = ["gather.cc"],
    hdrs = ["gather.h"],
    deps = [
        "//yacl/base:exception",
        "//yacl/link:context",
        "//yacl/link:trace",
        "//yacl/utils:serialize",
        "@com_github_fmtlib_fmt//:fmtlib",
    ],
)

yacl_cc_test(
    name = "gather_test",
    srcs = ["gather_test.cc"],
    deps = [
        ":gather",
        "//yacl/link:test_util",
    ],
)

yacl_cc_library(
    name = "allgather",
    srcs = ["allgather.cc"],
    hdrs = ["allgather.h"],
    deps = [
        "//yacl/base:exception",
        "//yacl/link:context",
        "//yacl/link:trace",
        "//yacl/utils:serialize",
        "@com_github_fmtlib_fmt//:fmtlib",
    ],
)

yacl_cc_test(
    name = "allgather_test",
    srcs = ["allgather_test.cc"],
    deps = [
        ":allgather",
        "//yacl/link:test_util",
    ],
)
